package com.lx.patterns.iterator;

/**
 * @ClassName Client
 * @Description: 测试客户端
 * @Author: 落雪
 * @CreateDate: 2025/2/15 10:55
 * @UpdateUser: 落雪
 * @UpdateDate: 2025/2/15 10:55
 * @UpdateRemark:
 * @Version: 1.0
 */
public class Client {

    public static void main(String[] args) {
        StudentAggregate studentAggregate = new StudentAggregateImpl();

        studentAggregate.add(new Student("张三", 18));
        studentAggregate.add(new Student("李四", 18));
        studentAggregate.add(new Student("王五", 18));

        StudentIterator studentIterator = studentAggregate.getIterator();

        while (studentIterator.hasNext()) {
            Student student = studentIterator.next();
            System.out.println(student.getName() + ":" + student.getAge());
        }
    }
}
